import React, { PureComponent } from 'react';
import { Form, Input } from 'antd';

const { TextArea } = Input;

export default class Index extends PureComponent {
  render() {
    const { form, data = {} } = this.props;
    const { getFieldDecorator } = form;

    return (
      <Form layout='vertical'>
        <Form.Item label='角色编码'>
          {getFieldDecorator('roleCode', {
            initialValue: data.roleCode || undefined,
            rules: [{ required: true, message: '该项为必填项' }]
          })(
            <Input placeholder='请输入角色编码' size='large' />
          )}
        </Form.Item>
        <Form.Item label='角色名称'>
          {getFieldDecorator('roleName', {
            initialValue: data.roleName || undefined,
            rules: [{ required: true, message: '该项为必填项' }]
          })(
            <Input placeholder='请输入角色名称' size='large' />
          )}
        </Form.Item>
        <Form.Item label='角色名称'>
          {getFieldDecorator('description', {
            initialValue: data.description || undefined,
          })(
            <TextArea rows={4} placeholder='请输入角色描述' />
          )}
        </Form.Item>
      </Form>
    );
  }
}